package sms

import (
	"sync"

	"gitee.com/sweetsunnyflower/carpooling-server-go/pkg/config"
)

type Sms struct {
	Driver Driver
}

var once sync.Once

var this *Sms

func New() *Sms {
	once.Do(func() {
		this = &Sms{
			Driver: &Aliyun{},
		}
	})
	return this
}

func (sms *Sms) Send(phone string, message Message) bool {
	return sms.Driver.Send(phone, message, config.GetStringMapString("sms.aliyun"))
}
